package com.yangchao.webflux.controller;

import com.yangchao.webflux.damain.Person;
import com.yangchao.webflux.repositories.PersonRepository;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;


@RestController
@RequestMapping("")
public class MyRestController {

    Logger log = org.slf4j.LoggerFactory.getLogger(MyRestController.class);

    @Autowired
    PersonRepository personRepository;


    @GetMapping("/persons")
    public Flux<Person> getUser() {
        return personRepository.findAll();
    }

}